<html>
<head><meta charset="utf-8"><title>Getting strings out of string literals · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html">Getting strings out of string literals</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223878442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223878442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223878442">(Jan 25 2021 at 10:29)</a>:</h4>
<p>Do we have a helper to unquote a string out of a <code>Literal</code>? <code>concat</code> in MBE tries to do that manually and mangles some strings.</p>



<a name="223878719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223878719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223878719">(Jan 25 2021 at 10:32)</a>:</h4>
<p>Oh, there's one next to it</p>



<a name="223880749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223880749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223880749">(Jan 25 2021 at 10:54)</a>:</h4>
<p>yeah, there is <code>unquote_str</code> in <code>builtin_macro.rs</code> if you are talking about <a href="https://github.com/rust-analyzer/rust-analyzer/issues/7417">https://github.com/rust-analyzer/rust-analyzer/issues/7417</a></p>



<a name="223880774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223880774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223880774">(Jan 25 2021 at 10:54)</a>:</h4>
<p>Yup, found it</p>



<a name="223884078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223884078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223884078">(Jan 25 2021 at 11:33)</a>:</h4>
<p>Heh, <code>concat!("foo2", r#false)</code> doesn't work in <code>rustc</code></p>



<a name="223884127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223884127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223884127">(Jan 25 2021 at 11:33)</a>:</h4>
<p>Should we treat <code>true</code> and <code>false</code> as <code>Literal</code> instead of <code>Ident</code>? They're special-cased in <code>syntax_bridge</code></p>



<a name="223884548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223884548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223884548">(Jan 25 2021 at 11:39)</a>:</h4>
<p><code>macro_rules!</code> accepts them as both <code>ident</code> and <code>literal</code></p>



<a name="223885039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Getting%20strings%20out%20of%20string%20literals/near/223885039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Edwin Cheng <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Getting.20strings.20out.20of.20string.20literals.html#223885039">(Jan 25 2021 at 11:44)</a>:</h4>
<p>Yeah, I think we should special-cased it in mbe meta variable matching  instead.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>